package com.dy.nygl.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dy.nygl.mapper.MeasureParamterMapper;
import com.dy.nygl.pojo.MeasureParamter;
import com.dy.nygl.service.MeasureParamterService;

@Service("measureParamterService")
public class MeasureParamterServiceImpl implements MeasureParamterService{

	@Resource(name="measureParamterDAO")
	private MeasureParamterMapper measureParamterDAO;
	
	/**
	 * getMeasureParamterAllList 获得测量参数列表
	 */
	public List<MeasureParamter> getMeasureParamter(int begin, int end) {
		List<MeasureParamter> list = measureParamterDAO.getMeasureParamterAllList();
		if(list !=null && list.size() > 0) {
			if(list.size() > (end - begin)) {
				list.subList(begin, end);
			}
			return list;
		}
		return null;
	}

	/**
	 * getMeasureParamterCount 获得测量参数总个数
	 */
	public int getMeasureParamterCount() {
		return measureParamterDAO.getMeasureParamterCount();
	}
	
	
	/**
	 * getMeasureParamterById 通过id获得某个测量参数
	 */
	public MeasureParamter getMeasureParamterById(int id) {
		MeasureParamter mp = measureParamterDAO.getMeasureParamterById(id);
		if(mp != null) {
			return mp;
		}
		return null;
	}

	/**
	 * addMeasureParamter 添加一个测量参数
	 */
	public void addMeasureParamter(MeasureParamter mp) {
		measureParamterDAO.addMeasureParamter(mp);
	}

	/**
	 * updateMeasureParamter 更新/编辑某个测量参数
	 */
	public void updateMeasureParamter(MeasureParamter mp) {
		measureParamterDAO.updateMeasureParamter(mp);
	}

	/**
	 * deleteMeasureParamter 删除某个测量参数
	 */
	public void deleteMeasureParamter(MeasureParamter mp) {
		measureParamterDAO.deleteMeasureParamter(mp);
	}

}
